/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://github.com/mineadmin
 */

import type { ComposerTranslation } from 'vue-i18n'
import { useTrans } from './auto-imports/useTrans'

export function useLocalTrans(key: any | null = null): string | ComposerTranslation | any {
  // 使用全局的 useTrans 来避免局部作用域的 useI18n 警告
  const { globalTrans } = useTrans()
  return key === null ? globalTrans as ComposerTranslation : globalTrans(key) as string
}
